package net.zoneland.knowledge.dao;

import net.zoneland.knowledge.controller.bean.UomUserOrgQueryVo;
import net.zoneland.knowledge.model.PartyOrg;
import net.zoneland.knowledge.model.PartyOrgLeader;
import net.zoneland.knowledge.model.PartyOrgVoForSelect;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;

import java.util.List;

/**
 * 党组织领导接口
 */
@Mapper
public interface PartyOrgLeaderMapper {
    /**
     * 查询党组织领导.
     * @param orgUuid 组织id
     * @return 党组织集合
     */
    @Select({"select DISPLAY_NAME ,MOBILE, YG_ID from (",
        "select min(DISPLAY_NAME) DISPLAY_NAME,min(MOBILE) MOBILE,YG_ID,min(taxis) taxis",
        "FROM AITK_PARTY_ORG_LEADER WHERE ORG_UUID = #{orgUuid,jdbcType=VARCHAR} and is_current=1 group by YG_ID ) order by taxis",
    })
    @Results(id = "orgLeader", value = {
        @Result(column="DISPLAY_NAME", property="displayName", jdbcType= JdbcType.VARCHAR, id=true),
        @Result(column="MOBILE", property="mobile", jdbcType=JdbcType.VARCHAR),
        @Result(column="YG_ID", property="ygId", jdbcType=JdbcType.VARCHAR)
    })
    List<PartyOrgLeader> queryByOrgUuid(String orgUuid);

    /**
     * 根据员工id获取党组织领导里的身份
     * @param ygId
     * @return
     */
    @Select({"select POSITION_TITLE from AITK_PARTY_ORG_LEADER where YG_ID = #{ygId, jdbcType=VARCHAR}  and is_current = 1"})
    List<String> getPositionByYgId(String ygId);
}
